package day05;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Scanner;

public class 标准 {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
       /* int score =0;
        for (int i=1;i<=10;i++){
            int a=(int) (Math.random()*100);
            int b=(int) (Math.random()*100);
            int result =a+b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            System.out.println("算吧");
            int answer=scan.nextInt();
            if(answer==result){
                System.out.println("答对了");
                score+=10;
            }else{
                System.out.println("错了");
            }

        }
        System.out.println("总分为："+score);*/
        //2)
        /*for (int num=1;num<=9;num++){
            for (int i=1;i<=num;i++){
                System.out.println(i+"*"+num+"="+i*num+"/t");
            }
            System.out.println();
        }*/
        //3)
        /* int[] arr=new int[10];*/
        //4)
        /*int[] arr=new int[3];
        int[] arr1= {2,5,8};
        int[] arr2=new int[]{2,5,8};
        int[]arr4;
        arr4=new int[]{2,5,8};*/
        //5)
       /* int[] arr=new int[3];
        System.out.println(arr.length);
        arr[0]=100;
        arr[1]=200;
        arr[2]=300;
        System.out.println(arr[arr.length-1]);*/
        //6)
       /* int[]arr=new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int) (Math.random()*100);
            System.out.println(arr[i]);
        }*/
        //7)
       /* int[] arr = new int[10];
        for(int i=0;i<arr.length;i++){
            arr[i] = (int)(Math.random()*100);
            System.out.println(arr[i]);
        }

        int max = arr[0]; //假设第1个元素为最大值
        for(int i=1;i<arr.length;i++){ //遍历剩余元素
            if(arr[i]>max){   //若剩余元素大于max
                max = arr[i]; //将max修改为较大的
            }
        }
        System.out.println("最大值为:"+max);*/
        //8)
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 100);
            System.out.println(arr[i]);
        }

        Arrays.sort(arr);

        System.out.println("排序后:");
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }

        System.out.println("倒着输出:");
        for (int i = arr.length - 1; i >= 0; i--) {
            System.out.println(arr[i]);
        }
        System.out.println("第1个元素为:" + arr[0]);
    }
}